# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/10/16 09:28
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : global_adapt_equalize.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
from skimage import exposure
from skimage.io import imread
from DIP_experiment_5.util import contrast_show

im_path = "../experiment_fig/ch3.tif"
font_path = "C:/Windows/Fonts/simhei.ttf"
im = imread(im_path)
global_equal_im = exposure.equalize_hist(im)
adapt_equal_im1 = exposure.equalize_adapthist(im, kernel_size=(3, 3))
adapt_equal_im2 = exposure.equalize_adapthist(im, kernel_size=(5, 5))
im_dict = {"原始图像": im, "全局直方图均衡化图像": global_equal_im,
           "3x3局部直方图均衡化图像": adapt_equal_im1, "5x5局部直方图均衡化图像": adapt_equal_im2}
contrast_show(im_dict, (2, 2),hspace=0.4, font=font_path)
